<?php

namespace App\Admin\Actions\NewsAction;

use App\Models\User;
use Illuminate\Support\Facades\DB;
use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;
use OpenAI;
use Rainsens\Dinglog\Facades\Dinglog;
use App\Jobs\BriefCrreateJob;

class BriefCreate extends RowAction
{
    public $name = '摘要生成';
    
    public function handle(Model $model)
    {
	   //	dd($model);
	    dispatch(new BriefCrreateJob($model))->onQueue('brief');

	    return $this->response()->success('摘要正在生成，请耐心等待')->refresh();
    }

   
	public function dialog()
	{
		$this->confirm('确定生成该摘要吗?');
	}
}
